$(".select-box ul").on('click','li',function(){
    $(this).parent().siblings('.show').val($(this).html());
    $(this).parent().siblings('.hidden').val($(this).attr('data-id'));
});
$(".select-box div.fl").click(function(e){
    console.log('ss');
    e.stopPropagation();
    var div=$(this);
    div.children('ul').toggleClass('hide');
    $(document).click(function() {
        if (!div.children('ul').hasClass("hide")) {
            div.children('ul').addClass("hide");
        }
    });
});
//w调用日期选择插件
$('#datePicker').daterangepicker();
$('body').on('click','.applyBtn',function(){
    var date = $('#datePicker').val();
    console.log(date);
    arr=date.split(" - "); 
    var startDate = arr[0];
    var endDate = arr[1];
   $("#startdate").val(startDate);
   $("#enddate").val(endDate);
   console.log(startDate,endDate);
   window.location.href = "/DistributorSystem/report/findOrderProductCountByProduct?start="+startDate+"&end="+endDate;
 });


//单选
$(".status").on("click",function(){
    $(this).addClass("on").siblings().removeClass("on");
});
$(document).ready(function(){
    var myChart1 = echarts.init(document.getElementById('chart-block'));
    option1 = {
        tooltip : {
            trigger: 'item',
            formatter: "金额:￥{c}<br/>占比:{d}%",
            padding:[10,15]
        },
        legend: {
            orient: 'vertical',
            left: 700,
            top:'20%',
            data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎','语文','数学','英语','体育']
        },
        color:['#FCED88','#82C247','#EEACA3','#5DBBC5','#F5C53A','#1FE57C','#E3AFFF','#93CBE9','#5598FC','#afa'],
        series : [
            {
                name: '商品名称',
                type: 'pie',
                radius : '75%',
                center: [300,250],
                data:[
                    {value:335, name:'直接访问'},
                    {value:310, name:'邮件营销'},
                    {value:234, name:'联盟广告'},
                    {value:135, name:'视频广告'},
                    {value:1548, name:'搜索引擎'},
                    {value:584, name:'语文'},
                    {value:152, name:'数学'},
                    {value:59, name:'英语'},
                    {value:20, name:'体育'},
                ],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };

    myChart1.setOption(option1);
});
window.onresize = function(){
	myChart1.resize(); //myEchart为echarts.init初始化得到的对象
}
